Video Classification Systems and Methods

ABSTRACT

Video encoder systems and methods are described that employ table-based content classification. One or more tables relate quantization parameters and P-points for a frame of video that typically comprises macroblocks. A deviation representative of a difference between original and decoded versions of a macroblock is determined, the deviation being further representative of a distribution frequency of the value of a distortion for a P-point. The P-point corresponds to a distortion value that is associated with a minimum rate difference between encoding modes for a macroblock. A motion complexity index is updated using a quantization parameter and non-zero coefficients of the encoded frame. An encoding mode for the macroblock can be retrieved from the tables using the motion complexity index to reference mode information maintained in the tables.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims priority from PCT/CN2010/076569 (title:“Video Classification Systems and Methods”) which was filed in theChinese Receiving Office on Sep. 2, 2010, from PCT/CN2010/076564 (title:“Rho-Domain Metrics”) which was filed in the Chinese Receiving Office onSep. 2, 2010, from PCT/CN2010/076555 (title: “Video Analytics forSecurity Systems and Methods”) which was filed in the Chinese ReceivingOffice on Sep. 2, 2010, and from PCT/CN2010/076567 (title: “Systems AndMethods for Video Content Analysis) which was filed in the ChineseReceiving Office on Sep. 2, 2010, each of these applications beinghereby incorporated herein by reference. The present Application is alsorelated to concurrently filed U.S. Patent non-provisional applicationsentitled “Rho-Domain Metrics” (attorney docket no. 043497-0393276),“Video Analytics for Security Systems and Methods” (attorney docket no.043497-0393277) and “Systems And Methods for Video Content Analysis”(attorney docket no. 043497-0393278), which are expressly incorporatedby reference herein.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates the relationship of distortion and rate differencebetween Intra Inter modes for a given quantization parameter.

FIG. 2 is a flowchart illustrating a content classification based modedecision method.

FIG. 3 is a simplified block schematic illustrating a processing systememployed in certain embodiments of the invention.

DETAILED DESCRIPTION

Embodiments of the present invention will now be described in detailwith reference to the drawings, which are provided as illustrativeexamples so as to enable those skilled in the art to practice theinvention. Notably, the figures and examples below are not meant tolimit the scope of the present invention to a single embodiment, butother embodiments are possible by way of interchange of some or all ofthe described or illustrated elements. Wherever convenient, the samereference numbers will be used throughout the drawings to refer to sameor like parts. Where certain elements of these embodiments can bepartially or fully implemented using known components, only thoseportions of such known components that are necessary for anunderstanding of the disclosed embodiments will be described, anddetailed descriptions of other portions of such known components will beomitted so as not to obscure the disclosed embodiments. In the presentspecification, an embodiment showing a singular component should not beconsidered limiting; rather, the invention is intended to encompassother embodiments including a plurality of the same component, andvice-versa, unless explicitly stated otherwise herein. Moreover,applicants do not intend for any term in the specification or claims tobe ascribed an uncommon or special meaning unless explicitly set forthas such. Further, certain embodiments of the present invention encompasspresent and future known equivalents to the components referred toherein by way of illustration.

Video standards such as H.264/AVC employ mode decision as an encodingdecision process to determine whether a macroblock (“MB”) is encoded asan intra-prediction mode (“Intra Mode”) or an inter-prediction mode(“Inter Mode”). Rate-distortion optimization techniques are commonlyapplied in various implementations. When encoding a MB, rate-distortioncost is calculated for both Intra Modes and Inter Modes. The minimumcost mode is selected as the final encoding mode. Depending on the videostandard, multiple Intra Modes and Inter Modes are applied. For example,in H.264 standard, there are 4 Intra 16×16 Modes and 9 Intra 4×4 Modesfor each MB, and skip macroblock, Inter 16×16 Mode, Inter 16×8, 8×16,8×8, 8×4, 4×8 and 4×4 Modes for each MB. Rate-distortion cost J isdefined as

J=D+λ*R,  (1)

where distortion D is defined as the difference between reconstructed MBand original MB, where rate R represents the bits used to encode thecurrent MB, and where coefficient λ is a weighting factor. In oneexample, the sum of absolute differences (SAD) can be used to quantifydistortion.

Rate-Distortion Optimization

Rate-distortion optimization (RDO) techniques can provide a balance ofencoding quality and compression ratio. An accurate calculation of rateR in equation (1) is computationally costly and generally involves adual-pass encoding process which requires the use of hardware resourcesand which introduces additional delays. Research has been conducted tooptimize the calculation of R and to provide a fast rate-distortionbalanced mode decision algorithm. However, estimation of bit rate R perMB is generally very costly due to tight pipeline architectures employedin hardware embodiments that provide real-time encoding andmultiple-channel encoding.

Accordingly, in certain embodiments, distortion D is used to determinethe mode decision when R is omitted from equation (1). Mode optimizationtypically cannot be achieved by using D alone without considering thebit rate perspective of encoding. For example, in the low-complexbackground cases, Intra Mode's SAD values for background MBs can besmaller than Inter Mode SAD values: therefore, Intra-mode is typicallyselected for background MBs. However, Intra Mode encoding usuallyconsumes many more bits than Inter Mode encoding and, consequentially,encoding bits may be wasted and background blocky artifacts can beobserved.

Certain embodiments employ a comparison of rate cost distortions J_intra and J_int er. Based on equation (1), a comparison can be taken asequivalent to the comparison of D_(int ra)+λ*(ΔR)

D_(int er) shown in Equation (2), where λ*(ΔR) (denoted hereafter τ) isthe rate difference weighting factor between Intra mode and Inter mode.

J _(int er) =D _(int er)

J _(int ra) =D _(int ra)

Experimental results show there is a pseudo tangent relationship betweenΔR and distortion for a given quantization parameter (“QP”) as shown inFIG. 1.

FIG. 1 shows the relationship of ΔR and D for a given QP (in FIG. 1,QP=26), and, in FIG. 1, SAD is used as distortion andΔR=R_(int ra)−R_(int er). For the purposes of this description,R_(int ra) represents bit numbers used by the intra mode encoder toencode the current microblock, and R_(int er) represents bit numbersused by the inter mode encoder to encode current microblock. A point Pis defined as the point at which Diff_R (ΔR) is equal to the zero pointon axis X. Points with D values less than P will consume more bits withIntra Mode encoding (ΔR(=R_(int ra)−r_(int er))>0), while points with Dvalues larger than P will consume less bits with Intra Mode, as shown inthe drawing. Experimental results show there is a pseudo tangentrelationship between ΔR and distortion for a given QP. The location ofP-point is a function of QP and video motion complexity, P-pointsincrease along with the increasing of QP and motion complexity. After aP-point is located, deviation r can be estimated and the IntraMode/Inter Mode decision can be reached quickly and with greater ease,based on the tangent curve and D value distribution frequency.

Rho-Domain Content Classification

Certain embodiments of the invention use Rho-domain (“ρ-domain”) contentclassification and certain embodiments provide an innovative ρ-domainmetric “θ” and employ systems and methods that apply the metric. In someembodiments, the definition of ρ in ρ-domain can be taken to be thenumber of non-zero coefficients after transform and quantization in avideo encoding process. Additionally, the term “NZ” will be used hereinto represent ρ, where NZ can be understood as meaning a number ofnon-zero coefficients after quantization of each macroblock in videostandards such as the H.264 video standard. For the purposes of thisdescription, a ρ-domain deviation metric θ may be defined as a recursiveweighted ratio between the theoretical NZ_QP curve and the actual NZ_QPcurve. Normalized θ typically fluctuates around 1.0. A value of θsmaller than 1.0 can indicate that the actual encoded bit rate is largerthan the expectation, implying that a more complicated motion contextualcontent has been encountered. In contrast, a value of θ larger than 1.0indicates that the actual encoded bit rate is smaller than theexpectation, implying that smoother motion content has been encountered.Therefore, ρ-domain deviation θ can be used as an indicator to classifyvideo content to high motion complexity, medium, medium-low and lowmotion complexity categories. Based on motion complexity classification,a fast mode decision algorithm can be employed.

Example of a Content Classification Based Mode Decision Algorithm

In the example of FIG. 2, a content classification based mode decisionalgorithm is illustrated. The algorithm may be embodied in a combinationof hardware and software and may be deployed as instructions and datastored in a non-transitory computer readable media. It will beappreciated that the instructions and data may be configured and/oradapted such that execution of the instructions by a processor cause theprocessor to perform the method described in FIG. 2.

At step 200, offline trained quantization parameter QP and P-pointtables QP_P_T_(n) are built based on p-domain content classifications,while T_(n)(T_(n)=1, 2, 3, . . . 51) denotes different motion complexityclassifications. If at step 203 it is determined that a current framebelongs to the first 5 frames of a video sequence, then step 204 isperformed next; otherwise step 203 is performed next. At step 204,motion complexity index T_(n) is initiated based on initial QP andcomplexity information and the P-point can be found from QP_P_T_(n)tables. Step 206 can then be performed.

If at step 202 it is identified that the current frame does not belongto the first 5 frames of a video sequence then, at step 203, NZ_QPdeviation θ is calculated based on the encoded frame NZ and QPinformation. At step 205, the motion complexity index based on T_(n) isthen recalculated based on deviation θ. A table lookup from QP_P_T_(n)tables may be performed to find P for the current frame based onweighted previous frame's QP value and content classification indexT_(n) before performing step 206.

At step 206, deviation τ is calculated with respect to distortion Dbased on the tangent relationship of τ and D, the distribution frequencyof D, and the location of P-point. A mathematical model φ can beestablished as a function of P-point, D and QP for each motioncomplexity class to represent the cost deviation τ for each MB.

One example of a QP_P_T_(n) is shown in Table 1, here below:

TABLE 1 QP_P_Tn table   QP_P_Tn : static int MD_P_TABLE[ ][ ]={ //{T1,T2,T3,P_point_T1,P_point_T2,P_point_T3}   {0.8,1.1,2,4,6,6}, //QP= 14   {0.8,1.1,2,4,6,6}, //QP = 15   {0.8,1.1,2,5,7,7}, //QP = 16  {0.8,1.1,2,5,7,7}, //QP = 17   {0.8,1.1,2,6,8,8}, //QP = 18  {0.8,1.1,2,6,8,8}, //QP = 19   {0.8,1.1,2,7,9,9}, //QP = 20  {0.8,1.1,2,8,9,9}, //QP = 20   ....  } //Listed in the table arerelative values. //From QP and content classification index Tn, andP_point can be obtained form the MD_P_TABLE

At step 208, mode decisions for each MB of current frame can be taken.Inter Mode RD cost J_(int er) can be replaced by D as shown in equation(2) and Intra Mode cost J_(int ra) can be replaced by D+τ, where τ isderived from experimental model φ as described at step 206. A winningmode may be selected as the mode which yields the minimum mode costJ_(min). The process is typically repeated until it is determined at 210the encoding of the current frame is finished.

In certain embodiments, the mode-decision algorithm, QP_P_T_(n) tableand deviation model φ are built offline from experimental results.Motion classification index T_(n) and its corresponding methods aredescribed in a related, concurrently filed application titled “ρ-domainmetrics θ and its applications.” The video classification based modedecision algorithms, systems and methods described herein can provide avery cost efficient, fast and robust alternative approach compared withconventional systems that tend to be computationally costly, and whichare usually involve dual-pass encoding mode decision algorithms. Incertain embodiments of the present invention. A fast table-lookup methodis used to get a P-point value. From the P-point, QP and contentclassification index T_(n), and MB cost deviation τ can be obtained froma selected experimental model φ. Mode decisions can be made efficientlyby inserting τ into equation (2).

System Description

Turning now to FIG. 3, certain embodiments of the invention employ aprocessing system that includes at least one computing system 30deployed to perform certain of the steps described above. Computingsystem 30 may be a commercially available system that executescommercially available operating systems such as Microsoft Windows®,UNIX or a variant thereof, Linux, a real time operating system and or aproprietary operating system. The architecture of the computing systemmay be adapted, configured and/or designed for integration in theprocessing system, for embedding in one or more of an image capturesystem, communications device and/or graphics processing systems. In oneexample, computing system 30 comprises a bus 302 and/or other mechanismsfor communicating between processors, whether those processors areintegral to the computing system 30 (e.g. 304, 305) or located indifferent, perhaps physically separated computing systems 300.Typically, processor 304 and/or 305 comprises a CISC or RISC computingprocessor and/or one or more digital signal processors. In someembodiments, processor 304 and/or 305 may be embodied in a custom deviceand/or may perform as a configurable sequencer. Device drivers 303 mayprovide output signals used to control internal and external componentsand to communicate between processors 304 and 305.

Computing system 30 also typically comprises memory 306 that may includeone or more of random access memory (“RAM”), static memory, cache, flashmemory and any other suitable type of storage device that can be coupledto bus 302. Memory 306 can be used for storing instructions and datathat can cause one or more of processors 304 and 305 to perform adesired process. Main memory 306 may be used for storing transientand/or temporary data such as variables and intermediate informationgenerated and/or used during execution of the instructions by processor304 or 305. Computing system 30 also typically comprises non-volatilestorage such as read only memory (“ROM”) 308, flash memory, memory cardsor the like; non-volatile storage may be connected to the bus 302, butmay equally be connected using a high-speed universal serial bus (USB),Firewire or other such bus that is coupled to bus 302. Non-volatilestorage can be used for storing configuration, and other information,including instructions executed by processors 304 and/or 305.Non-volatile storage may also include mass storage device 310, such as amagnetic disk, optical disk, flash disk that may be directly orindirectly coupled to bus 302 and used for storing instructions to beexecuted by processors 304 and/or 305, as well as other information.

In some embodiments, computing system 30 may be communicatively coupledto a display system 312, such as an LCD flat panel display, includingtouch panel displays, electroluminescent display, plasma display,cathode ray tube or other display device that can be configured andadapted to receive and display information to a user of computing system30. Typically, device drivers 303 can include a display driver, graphicsadapter and/or other modules that maintain a digital representation of adisplay and convert the digital representation to a signal for driving adisplay system 312. Display system 312 may also include logic andsoftware to generate a display from a signal provided by system 300. Inthat regard, display 312 may be provided as a remote terminal or in asession on a different computing system 30. An input device 314 isgenerally provided locally or through a remote system and typicallyprovides for alphanumeric input as well as cursor control 316 input,such as a mouse, a trackball, etc. It will be appreciated that input andoutput can be provided to a wireless device such as a PDA, a tabletcomputer or other system suitable equipped to display the images andprovide user input.

In certain embodiments, computing system 30 may be embedded in a systemthat captures and/or processes images, including video images. In oneexample, computing system may include a video processor or accelerator317, which may have its own processor, non-transitory storage andinput/output interfaces. In another example, video processor oraccelerator 317 may be implemented as a combination of hardware andsoftware operated by the one or more processors 304, 305. In anotherexample, computing system 30 functions as a video encoder, althoughother functions may be performed by computing system 30. In particular,a video encoder that comprises computing system 30 may be embedded inanother device such as a camera, a communications device, a mixingpanel, a monitor, a computer peripheral, and so on.

According to one embodiment of the invention, portions of the describedinvention may be performed by computing system 30. Processor 304executes one or more sequences of instructions. For example, suchinstructions may be stored in main memory 306, having been received froma computer-readable medium such as storage device 310. Execution of thesequences of instructions contained in main memory 306 causes processor304 to perform process steps according to certain aspects of theinvention. In certain embodiments, functionality may be provided byembedded computing systems that perform specific functions wherein theembedded systems employ a customized combination of hardware andsoftware to perform a set of predefined tasks. Thus, embodiments of theinvention are not limited to any specific combination of hardwarecircuitry and software.

The term “computer-readable medium” is used to define any medium thatcan store and provide instructions and other data to processor 304and/or 305, particularly where the instructions are to be executed byprocessor 304 and/or 305 and/or other peripheral of the processingsystem. Such medium can include non-volatile storage, volatile storageand transmission media. Non-volatile storage may be embodied on mediasuch as optical or magnetic disks, including DVD, CD-ROM and BluRay.Storage may be provided locally and in physical proximity to processors304 and 305 or remotely, typically by use of network connection.Non-volatile storage may be removable from computing system 304, as inthe example of BluRay, DVD or CD storage or memory cards or sticks thatcan be easily connected or disconnected from a computer using a standardinterface, including USB, etc. Thus, computer-readable media can includefloppy disks, flexible disks, hard disks, magnetic tape, any othermagnetic medium, CD-ROMs, DVDs, BluRay, any other optical medium, punchcards, paper tape, any other physical medium with patterns of holes,RAM, PROM, EPROM, FLASH/EEPROM, any other memory chip or cartridge, orany other medium from which a computer can read.

Transmission media can be used to connect elements of the processingsystem and/or components of computing system 30. Such media can includetwisted pair wiring, coaxial cables, copper wire and fiber optics.Transmission media can also include wireless media such as radio,acoustic and light waves. In particular radio frequency (RF), fiberoptic and infrared (IR) data communications may be used.

Various forms of computer readable media may participate in providinginstructions and data for execution by processor 304 and/or 305. Forexample, the instructions may initially be retrieved from a magneticdisk of a remote computer and transmitted over a network or modem tocomputing system 30. The instructions may optionally be stored in adifferent storage or a different part of storage prior to or duringexecution.

Computing system 30 may include a communication interface 318 thatprovides two-way data communication over a network 320 that can includea local network 322, a wide area network or some combination of the two.For example, an integrated services digital network (ISDN) may used incombination with a local area network (LAN). In another example, a LANmay include a wireless link. Network link 320 typically provides datacommunication through one or more networks to other data devices. Forexample, network link 320 may provide a connection through local network322 to a host computer 324 or to a wide are network such as the Internet328. Local network 322 and Internet 328 may both use electrical,electromagnetic or optical signals that carry digital data streams.

Computing system 30 can use one or more networks to send messages anddata, including program code and other information. In the Internetexample, a server 330 might transmit a requested code for an applicationprogram through Internet 328 and may receive in response a downloadedapplication that provides or augments functional modules such as thosedescribed in the examples above. The received code may be executed byprocessor 304 and/or 305.

Additional Descriptions of Certain Aspects of the Invention

The foregoing descriptions of the invention are intended to beillustrative and not limiting. For example, those skilled in the artwill appreciate that the invention can be practiced with variouscombinations of the functionalities and capabilities described above,and can include fewer or additional components than described above.Certain additional aspects and features of the invention are further setforth below, and can be obtained using the functionalities andcomponents described in more detail above, as will be appreciated bythose skilled in the art after being taught by the present disclosure.

Certain embodiments of the invention provide video encoder systems andmethods. In some of these embodiments, the encoder systems employcontent classification. Some of these embodiments comprise maintainingone or more tables relating quantization parameters and P-points for aframe of video. In some of these embodiments, the frame comprises one ormore macroblocks. Some of these embodiments comprise calculating adeviation representative of a difference between original and decodedversions of a macroblock. Some of these embodiments comprise calculatinga deviation representative of a distribution frequency of the value of adistortion. Some of these embodiments comprise calculating a deviationrepresentative of the location of a P-point. In some of theseembodiments, the P-point corresponds to a distortion value that isassociated with a minimum rate difference between encoding modes for amacroblock. Some of these embodiments comprise updating a motioncomplexity index using a quantization parameter and a number of non-zerocoefficients of the encoded frame. Some of these embodiments compriseselecting an encoding mode for the macroblock using the motioncomplexity index to reference mode information maintained in the one ormore tables.

In some of these embodiments, the selected mode yields a least costencoding. In some of these embodiments. In some of these embodiments,the deviation comprises a weighted difference of estimated distortionand measured distortion for a selected quantization parameter value. Insome of these embodiments, the deviation is normalized. In some of theseembodiments, calculating the deviation representative of the differencebetween original and decoded versions of a macroblock is based on atangential relationship between the distortion and a rate differencebetween the encoding modes. In some of these embodiments, each P-pointcorresponds to a distortion value is associated with no rate differencebetween encoding modes for the macroblock. In some of these embodiments,the motion complexity index is initiated during receipt of an initialnumber of frames in a video sequence. In some of these embodiments,there are at least 5 frames in the initial number of frames in the videosequence.

Some of these embodiments comprise modeling cost of deviation for eachmotion complexity class for each macroblock as a function of P-point,distortion and quantization parameter. Some of these embodimentscomprise looking up a P-point for a current frame using a weightedquantization parameter value of a previous frame. In some of theseembodiments, the encoding modes comprise an inter-prediction mode and anintra-prediction mode. In some of these embodiments, the encoding modesare defined by the H.264 video standard.

Certain embodiments of the invention provide a video encoder 317 (seeFIG. 3). Some of these embodiments comprise a plurality of tablesrelating quantization parameters and encoding modes for a video frame.Some of these embodiments comprise a content classifier that selects anencoding mode for a macroblock of the video frame from the plurality oftables using a deviation representative of difference between originaland decoded versions of the macroblock. Some of these embodimentscomprise a processor that maintains a motion complexity index using aquantization parameter and non-zero coefficients of the encoded frame.In some of these embodiments, the motion complexity index is operable toselect an encoding mode based on the motion complexity of the frame. Insome of these embodiments, the selected mode yields a least costencoding for the frame. In some of these embodiments, the selected modeyields a least cost encoding for the macroblock. In some of theseembodiments, each P-point corresponds to a distortion value that isassociated with a minimum rate difference between encoding modes for amacroblock.

Although the present invention has been described with reference tospecific exemplary embodiments, it will be evident to one of ordinaryskill in the art that various modifications and changes may be made tothese embodiments without departing from the broader spirit and scope ofthe invention. Accordingly, the specification and drawings are to beregarded in an illustrative rather than a restrictive sense.

What is claimed is:
 1. A method of content classification in a videoencoder, comprising: calculating a deviation representative of adifference between original and decoded versions of a macroblock in aframe of video, a distribution frequency of the value of a distortionand the location of a P-point, wherein the macroblock is associated witha bit rate representing bits used to encode the macroblock, and whereina P-point represents a point in the frame at which a rate of change ofbit rate is equal to zero; updating a motion complexity index using aquantization parameter and a number of non-zero coefficients in themacroblock when encoded; and selecting an encoding mode for themacroblock using the motion complexity index to reference modeinformation maintained in one or more tables relating quantizationparameters to one or more P-points for the frame of video, wherein themode is selected to yield a least cost encoding, wherein the framecomprises a plurality of macroblocks, each macroblock associated with abit rate representing bits used to encode the each macroblock, andwherein each P-point corresponds to a distortion value that isassociated with a minimum rate difference between encoding modes for amacroblock.
 2. The method of claim 1, wherein the deviation comprises aweighted difference of estimated distortion and measured distortion fora selected quantization parameter value.
 3. The method of claim 1,wherein the deviation is normalized.
 4. The method of claim 1, whereincalculating the deviation representative of the difference betweenoriginal and decoded versions of a macroblock is based on a tangentialrelationship between the distortion and a rate difference between theencoding modes.
 5. The method of claim 1, wherein each P-pointcorresponds to a distortion value that is associated with no ratedifference between encoding modes for the macroblock.
 6. The method ofclaim 1, wherein the motion complexity index is initiated during receiptof an initial number of frames in a video sequence.
 7. The method ofclaim 6, wherein the initial number of frames in the video sequencecomprises 5 frames.
 8. The method of claim 1, further comprisingmodeling a cost of deviation for each motion complexity class for eachmacroblock as a function of P-point, distortion and quantizationparameter.
 9. The method of claim 1, further comprising looking up aP-point for a current frame using a weighted quantization parametervalue of a previous frame.
 10. The method of claim 1, wherein theencoding modes comprise an inter-prediction mode and an intra-predictionmode.
 11. The method of claim 1, wherein the encoding modes are definedby the H.264 video standard.
 12. A video encoder, comprising:non-transitory storage adapted to maintain a plurality of tablesrelating quantization parameters and encoding modes for a video frame;and a content classifier that selects an encoding mode for a macroblockof the video frame from the plurality of tables using a deviationrepresentative of a difference between original and decoded versions ofthe macroblock; and wherein the video encoder maintains a motioncomplexity index corresponding to a quantization parameter and non-zerocoefficients of the encoded frame, the motion complexity index beingoperable to select the encoding mode as a function of the motioncomplexity of the video frame, wherein the selected encoding mode yieldsa least-cost encoding.
 13. The video encoder of claim 12, wherein thedeviation is represented by a function of a P-point, a distortion and aquantization parameter, wherein each P-point corresponds to a distortionvalue that is associated with a minimum rate difference between encodingmodes for the macroblock.
 14. A non-transitory computer-readable mediumencoded with data and instructions wherein the data and instructions,when executed by a processor of a video encoder, cause the video encoderto perform a content classification method comprising: calculating adeviation representative of a difference between original and decodedversions of a macroblock of a frame of video, a distribution frequencyof the value of a distortion and the location of a minimum pointcorresponding to a distortion value associated with a minimum ratedifference between possible encoding modes for the macroblock; updatinga motion complexity index using a quantization parameter and a number ofnon-zero coefficients in the encoded macroblock; and selecting anencoding mode for the macroblock using the motion complexity index toreference mode information maintained in one or more tables by the videoencoder, the one or more tables relating quantization parameters andminimum points for the frame, wherein each macroblock of the frame isassociated with a bit rate representing bits used to encode the eachmacroblock, and wherein each minimum point represents a point in theframe at which a rate of change of bit rate is equal to zero.
 15. Thenon-transitory computer-readable medium of claim 14, wherein thedeviation comprises a weighted difference of estimated distortion andmeasured distortion for a selected quantization parameter value, andwherein the selected mode yields a least cost encoding.
 16. Thenon-transitory computer-readable medium of claim 15, wherein thedeviation comprises a weighted difference of estimated distortion andmeasured distortion for a selected quantization parameter value andwherein calculating the deviation representative of the differencebetween original and decoded versions of a macroblock includesdetermining a tangential relationship between the distortion and a ratedifference between the encoding modes.
 17. The non-transitorycomputer-readable medium of claim 14, wherein the method furthercomprises modeling cost of deviation for each motion complexity classfor each macroblock as a function of minimum point, distortion andquantization parameter.
 18. The non-transitory computer-readable mediumof claim 14, wherein the method further comprises looking up a minimumpoint for a current frame using a weighted quantization parameter valueof a previous frame.
 19. The non-transitory computer-readable medium ofclaim 14, wherein the encoding modes comprise an inter-prediction modeand an intra-prediction mode.
 20. The non-transitory computer-readablemedium of claim 14, wherein the encoding modes are defined by the H.264video standard.